<template>
	<view>
		<view class="relative main-bg margin" @tap="goDetail">
			<!-- <image src="../../static/wholesalebg2.png" mode="widthFix" class="w100"></image> -->
			<view class="absolute tips ">
				<view class="swiper " v-if="list.length > 0">
					<swiper :current="current" @change="change" :autoplay="true" :vertical="true" style="height: 40rpx;">
						<swiper-item v-for="(item,index) in list" :key="index">
							<view class="flex justify-start text-brown align-center text-left text-sm" style="color: #942c39;">
								<view class="text-overflow margin-left" style="max-width: 80rpx;">{{item.member?item.member.nickname:''}}</view>
								开团
							</view>
						</swiper-item>
					</swiper>
				</view>
			</view>
			<view class="absolute tips2 ">
				<view class="swiper " v-if="list.length > 0">
					<swiper :current="current" @change="change" :autoplay="true" :vertical="true" style="height: 80rpx;">
						<swiper-item v-for="(item,index) in list" :key="index">
							<view class="flex justify-start text-white text-xl text-left">
								<view class="text-overflow " style="max-width: 200rpx;">{{item.wholesaleProduct.type==0?item.wholesaleProduct.product.name:item.wholesaleProduct.title}}</view>
								开团
							</view>
						</swiper-item>
					</swiper>
				</view>
				<!-- <view v-else class="padding-left text-white text-xl ">
					暂无拼团~
				</view> -->
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		components: {},
		props: {
			value: {
				type: Object,
				default: null
			},
		},
		created: function(e) {},
		data() {
			return {
				lastid: 0,
				timmer: null,
				list: [],
				current: 0,
			}
		},
		methods: {
			updateset() {
				if (!this.timmer) {
					this.getTips()
					this.timmer = setInterval(this.getTips, 20000)
				}
			},
			getTips() {
				// this.$http
				// 	.get('marketing_wholesale_tips', {
				// 		lastid: this.lastid
				// 	})
				// 	.then((response) => {
				// 		if (response.data.data && response.data.data.length > 0) {
				// 			this.list = response.data.data.concat(this.list)
				// 			this.lastid = this.list[0] ? this.list[0].id : 0
				// 			this.current = 0
				// 		}
				// 		uni.hideLoading()
				// 	})
				// 	.catch((response) => {
				// 		uni.hideLoading()
				// 	})
			},
			goDetail() {
				if (this.list[this.current]) {
					var wholesale_id = this.list[this.current].wholesaleProduct.id
					uni.navigateTo({
						url: '/pages/shop/marketing/wholesale?id=' + wholesale_id
					})
				}
			},
			change(e) {
				this.current = e.detail.current
			}
		},
	}
</script>

<style>
	.main-bg {}

	.tips {
		top: 10rpx;
		left: 0;
		width: 100%;
		height: 40rpx;
		line-height: 40rpx;
		text-align: center;
		overflow: hidden;
	}

	.tips .swiper {
		width: 32%;
		height: 100%;
		margin: 0 auto;
	}

	.tips2 {
		top: 50rpx;
		left: 30rpx;
		width: 100%;
		height: 80rpx;
		line-height: 80rpx;
		text-align: center;
		overflow: hidden;
	}

	.tips2 .swiper {
		width: 48%;
		height: 100%;
		margin: 0 auto;
	}
</style>
